package com.spring.cloud.service;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
 * Created by Administrator on 2017/3/31.
 */
@Service
public class RibbonService {

    @Autowired
    RestTemplate restTemplate;

    public String sweep(String name){
        return "";
    }

    @HystrixCommand(fallbackMethod = "fallback")
    public String say(){
        return restTemplate.getForObject("http://SPRING-CLOUD-SERVICE/say", String.class);
    }

    public String fallback(){
        return "error";
    }

}
